#ifndef __MOVEMENT_H
#define __MOVEMENT_H

// #include "esp_types.h"

#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"
#include "driver/gptimer.h"
#include "esp_err.h"
#include "freertos/semphr.h"

#include "esp_log.h"
#include "driver/ledc.h"
#include "driver/gpio.h"
#include "esp_timer.h"
// #include "esp_rom_sys.h"
#include "driver/spi_master.h"



// #define spicmd(cmd)                             \
//     memset(&t, 0, sizeof(t));                   \
//     t.length = 8;                               \
//     t.tx_buffer = &cmd;                         \
//     t.user = (void *)0;                         \
//     ret = spi_device_polling_transmit(spi, &t); \
//     assert(ret == ESP_OK);

// #define spidata(data)                           \
//     memset(&t, 0, sizeof(t));                   \
//     t.length = 16;                              \
//     t.tx_buffer = &data;                        \
//     t.user = (void *)1;                         \
//     ret = spi_device_polling_transmit(spi, &t); \
//     assert(ret == ESP_OK);                      \
//     /* gpio_set_level(MPIN_NUM_CS, 1); */

// #define spisend(data)                           \
//     memset(&t, 0, sizeof(t));                   \
//     t.length = 24;                              \
//     t.tx_buffer = &data;                        \
//     t.user = (void *)1;                         \
//     ret = spi_device_polling_transmit(spi, &t); \
//     assert(ret == ESP_OK);

extern SemaphoreHandle_t IsMoving;
extern SemaphoreHandle_t TimeStampTest;
extern int *TimestoExec, *NeedLasertoSend;
extern uint16_t *pXDAValtoSend, *pYDAValtoSend;
extern int tmp;

void MovInit(void);
void XYStartMove(void);

#endif /* __MOVEMENT_H */
